Technote 1098ATA Device Software Guide Additions and Corrections |
CONTENTSErrors in the ATA Device Software Guide Device Config Structure in ATA 4.0 Detecting the Presence of the ATA Manager |
This Technote lists errors and additions to the ATA Device Software Guide We include both corrections to the original guide, as well as some minor additions for ATA Manager 4.0. ATA Manager 4.0 was introduced with the PowerBook 3400. This Technote is directed at developers who wish to call the ATA Manager directly. Normally, applications would never call the ATA Manager directly; instead, they use the the appropriate driver for the device in question. The ATA Manager is helpful for developers who are creating ATA device drivers, and for specialized applications which install such device drivers. |
Errors in the ATA Device Software Guide
Throughout. All mentions of the ATA-2 standard should be updated. The ATA Manager supports ATA-3 devices as well. Page 4: The ATA disk driver usually has a
driver reference number of -54 (decimal) but may also have a
different reference number if -54 is taken when the driver
is loaded. The driver name is You should never rely on the driver reference number. Use
the Page 6: The The Page 9: The The Page 9: The The Page 11: The The Page 38: ATA_RegAccess The MgrVersion.majorRev = $04 MgrVersion.minorAndBugRev = $00 or $10 are versions which do NOT work. MgrVersion.majorRev = $04 MgrVersion.minorAndBugRev = $11 does work. Page 48: Device Config Structure in ATA 4.0Several of the fields of this structure are obsolete starting with ATA Manager 4.0. struct ATADevConfig { SInt32 ataConfigSetting; // <->: Configuration setting*/ UInt8 ataPIOSpeedMode; // <->: Device access speed in PIO Mode UInt8 reserved; // padding UInt16 atapcValid; // <->: Obsolete with ATA 4 UInt16 ataRWMultipleCount; // Reserved for future (not supported yet) UInt16 ataSectorsPerCylinder; // Reserved for future (not supported yet) UInt16 ataHeads; // // Reserved for future (not supported yet) UInt16 ataSectorsPerTrack; // Reserved for future (not supported yet) UInt16 ataSocketNumber; // <--: (No longer supported with ATA 4) UInt8 ataSocketType; // <--: Specifies the socket type UInt8 ataDeviceType; // <--: Specifies the device type (get config only) UInt8 atapcAccessMode; // <->: Obsolete with ATA 4 UInt8 atapcVcc; // <->: Obsolete with ATA 4 UInt8 atapcVpp1; // <->: Obsolete with ATA 4 UInt8 atapcVpp2; // <->: Obsolete with ATA 4 UInt8 atapcStatus; // <->: Obsolete with ATA 4 UInt8 atapcPin; // <->: Obsolete with ATA 4 UInt8 atapcCopy; // <->: Obsolete with ATA 4 UInt8 atapcConfigIndex; // <->: Obsolete with ATA 4 UInt8 ataSingleDMASpeed; // <->: Single Word DMA Timing Class UInt8 ataMultiDMASpeed; // <->: Multiple Word DMA Timing Class UInt16 ataPIOCycleTime; // <->:Cycle time for PIO mode UInt16 ataMultiCycleTime; // <->:Cycle time for Multiword DMA mode UInt16 Reserved1[7]; // Reserved for future }; typedef struct ATADevConfig ATADevConfig;
Page 56: ATA_MgrInquiry In the |
Detecting the Presence of the ATA ManagerSome early ROMS could indicate that the ATA Manager exists without proper hardware. This would cause a crash. Therefore, you need to test for the presence of ATA hardware before detecting the presence of the ATA Manager. The following code snippet demonstrates how to detect the ATA Manager properly. // ---------------------------------------------- // returns true if this machine has ATA Manager // ---------------------------------------------- Boolean ATAManagerPresent(void) { UInt16 configFlags; Boolean ATAIsHere = true; configFlags = LMGetHWCfgFlags(); if (!(configFlags & 0x0080)) ATAIsHere = false; // (see Inside Mac VI 3-8 for TrapAvailable) if (ATAIsHere && TrapAvailable(kATATrap)) ATAIsHere = true; return ATAIsHere; } |
History of the ATA ManagerATA Manager 4.0 vs. ATA Manager 3.1ATA Manager 4.0 is PowerPC-Native.
ATA Manager 4.0 introduces the concept of the ATA Interface
Module or AIM, a plug-in hardware abstraction layer similar
to the SIM of SCSI Manager 4.3. The
ATA Manager 3.1 vs. ATA Manager 3.0The major change from version 3.0 to version 3.1 was the
addition of bus-specific transfer timing information to
function Altered functions for ATA Manager 3.0 are:
The ATA Manager reports its overall data transfer
capabilities via the ATA Manager 3.0 vs. ATA Manager 2.0The major feature added to ATA Manager 3.0 was the support of DMA I/O operations to the device. No new functions were added to the interface, although several functions now accept or report DMA-specific information. Expanded functions for ATA Manager 3.0 are:
ATA Manager 2.0 vs. ATA Manager 1.0The following list outlines several major features which were added in ATA Manager 2.0:
New functions were added and existing functions were
expanded to support new features listed above. Consequently,
different New functions for ATA Manager 2.0 are:
Expanded functions for ATA Manager 2.0 are:
In version 1.0 of the ATA manager, the
|
ATA Manager 4.0ATA Manager 4.0 is a redesign of the previous ATA Manager (3.1) undertaken in conjunction with the design of the PowerBook 3400. It is our expectation that every new CPU that supports ATA devices will use this new ATA Manager. The API between ATA Manager 4.0 and its clients (typically ATA and ATAPI disk device drivers) is a superset of ATA Manager 3.1. This allows old disk drivers to function correctly with the new ATA Manager. The ATA Manager prior to ATA 4.0 had knowledge about
specific types of ATA bus controllers. When a new CPU was
developed that had a different ATA bus controller, the ATA
Manager needed to be revised. The ATA 4.0 design contains a
hardware abstraction layer called the ATA Interface
Module or AIM. This AIM is a native driver
( The Operating System's Name Registry is used to contain
all of the hardware-specific information related to the ATA
bus controller. The ATA Manager will use the Name Registry
to locate and load the AIM, and the AIM will use CPU
specific information stored in the Name Registry to do its
initialization. For example, the base address of the ATA
registers will be calculated by There is currently no documentation available to external developers who wish to write an AIM. Such developers should contact Developer Support at the Contact Us page. Apple may work together with such developers to help develop appropriate documentation. While ATA Manager 4.0 is PowerPC-native, it still can
be accessed using the 68K trap. If you wish to call the ATA
manager on Power PC-equipped machines, you need to supply
some Mixed Mode glue to call the #include <MixedMode.h>#include <ATA.h> #define RESULT_OFFSET(type) \ ((sizeof(type) == 1) ? 3 : ((sizeof(type) == 2) ? 1 : 0)) #define TBTrapTableAddress(trapNum) (((trapNum & 0x03FF) << 2) + 0xE00) pascal SInt16 ataManager(ataPB *pb) { #ifdef applec #if sizeof(SInt16) > 4 #error "Result types larger than 4 bytes are not supported." #endif #endif long private_result; private_result = CallUniversalProc( *(UniversalProcPtr*)TBTrapTableAddress(0xAAF1), kPascalStackBased | RESULT_SIZE(SIZE_CODE(sizeof(SInt16))) | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(pb))), pb); return *(((SInt16*)&private_result) + RESULT_OFFSET(SInt16)); } |
Additional Event DocumentationThe following events were not well-documented in ATA Device Software Guide.
Note also that the |
Obsolete ResourcesThe following are some other places where the ATA Manager has been documented. These documents should be considered obsolete. They are replaced by the ATA Device Software Guide and this technote:
Q&A DV 24, ATA Manager Events Clarified has some additional ATA events. These events are incorporated in this document. This Q&A, which is incorporated in this document, should now be considered obsolete. Q&A DV 26, Calling ataManager on a Power Macintosh demonstrates how to call the ATA Manager from PowerPC code. This Q&A, which is incorporated in this document, should now be considered obsolete. The Q&As of develop issue 26 have some additional documentation of some ATA events. These are the same events discussed in Q&A DV 24, ATA Manager Events Clarified. These events are incorporated in this document. The develop Journal Q&As should be considered obsolete. Valid Resources
|
SummaryATA Manager 4.0 is a superset of ATA Manager 3.0, documented in the ATA Device Software Guide. There are some minor errors in that document. We welcome any additions or corrections to this technote or the ATA Device Software Guide; please use the Contact Us page. |
Some of the following documents may be available from ftp://fission.dt.wdc.com/x3t13/ x3t13.html or ftp://ftp.symbios.com/pub/standard s/io
|
Thanks to Rhoads Hollowell, Kevin Snow, Steve Schwander, Allen Watson, Michael Hinkson, Mike Duigou, and Vinnie Moscaritolo. |